/*
 * @Author: wang_sheshe
 * @Date: 2021-06-15 14:40:08
 * @LastEditTime: 2021-07-27 15:44:04
 * @Description: 数据抄录api
 */
import request from '@/utils/request'

/**
 * @description: 提交抄录数据 
 * @param {Object} data 请求参数
 */
export function submitCopyData(data) {
	return new Promise((resolve, reject) => {
        request.post('/server-name/sys/sendPhoneSms', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 查看历史 
 * @param {Object} data 请求参数
 */
export function getHistoryIInfo(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-item-config/getHistoryIInfo', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 查询设备类型下的设备和对应的间隔 
 * @param {Object} data 请求参数
 */
export function getDeviceByDeviceType(data) {
	return new Promise((resolve, reject) => {
        request.post('/infoInquiry/device/getDeviceByDeviceType', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 获取抄录项 
 * @param {Object} data 请求参数
 */
export function getCopyConfigList(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-item-config/getCopyConfigList', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}

/**
 * @description: 获取抄录子项 
 * @param {Object} data 请求参数
 */
export function getChildConfigList(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-item-config/getChildConfigList', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 获取间隔树
 * @param {Object} data 请求参数
 */
export function getDeviceByType(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-record/getDeviceByType', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 新增抄录
 * @param {Object} data 请求参数
 */
export function addCopyRecord(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-record/addCopyRecord', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 获取上一次抄录的值
 * @param {Object} data 请求参数
 */
export function getCopyValue(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-record/getCopyValue', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}
/**
 * @description: 批量抄录
 * @param {Object} data 请求参数
 */
export function addBatchCopy(data) {
	return new Promise((resolve, reject) => {
        request.post('/copy/copy-record/addBatchCopy', data).then(res => {
            if(res) {
                resolve(res)
            } else {
                resolve(false)
            }
        }, err => {
            reject(err)
        })
	})
}